package com.ruoyi.subscribe.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.subscribe.mapper.SubscribeMapper;
import com.ruoyi.subscribe.domain.Subscribe;
import com.ruoyi.subscribe.service.ISubscribeService;

/**
 * 消息订阅Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-14
 */
@Service
public class SubscribeServiceImpl implements ISubscribeService
{
    @Autowired
    private SubscribeMapper subscribeMapper;

    /**
     * 查询消息订阅
     *
     * @param id 消息订阅主键
     * @return 消息订阅
     */
    @Override
    public Subscribe selectSubscribeById(Long id)
    {
        return subscribeMapper.selectSubscribeById(id);
    }

    /**
     * 查询消息订阅列表
     *
     * @param subscribe 消息订阅
     * @return 消息订阅
     */
    @Override
    public List<Subscribe> selectSubscribeList(Subscribe subscribe)
    {
        return subscribeMapper.selectSubscribeList(subscribe);
    }

    /**
     * 新增消息订阅
     *
     * @param subscribe 消息订阅
     * @return 结果
     */
    @Override
    public int insertSubscribe(Subscribe subscribe)
    {
        subscribe.setCreateTime(DateUtils.getNowDate());
        return subscribeMapper.insertSubscribe(subscribe);
    }

    /**
     * 修改消息订阅
     *
     * @param subscribe 消息订阅
     * @return 结果
     */
    @Override
    public int updateSubscribe(Subscribe subscribe)
    {
        subscribe.setUpdateTime(DateUtils.getNowDate());
        return subscribeMapper.updateSubscribe(subscribe);
    }

    /**
     * 批量删除消息订阅
     *
     * @param ids 需要删除的消息订阅主键
     * @return 结果
     */
    @Override
    public int deleteSubscribeByIds(Long[] ids)
    {
        return subscribeMapper.deleteSubscribeByIds(ids);
    }


    /**
     * 批量逻辑删除消息订阅
     *
     * @param ids 需要删除的消息订阅主键
     * @return 结果
     */
    @Override
    public int logicDeleteSubscribe(Long[] ids,String delType,Long delUser)
    {
        return subscribeMapper.logicDeleteSubscribe(ids,delType,delUser);
    }

    /**
     * 删除消息订阅信息
     *
     * @param id 消息订阅主键
     * @return 结果
     */
    @Override
    public int deleteSubscribeById(Long id)
    {
        return subscribeMapper.deleteSubscribeById(id);
    }
}
